 |
|
 |
Subject: failed to access local database through local session. ERROR:Database has not been opened yet |
 |
 |
 |
Product Area: Notes 8 Client |
 |
Technical Area: Application development |
 |
Platform: ALL |
 |
Release: All |
 |
Reproducible: Always |
 |
 |
 |
 |
On notes side, I created a local nsf called localNSF.nsf. Then I wrote code try to access this nsf. I do not have Domino started, and nsf is only in the .../Lotus/Notes/data folder. The code are as follow:
[code]-------------------------------------------------------
lotus.notes.NotesThread.sinitThread();
lotus.domino.Session localSession = null;
try {// ------------- try to get a local session
localSession = NotesFactory.createSession();
} catch (NotesException e) {
e.printStackTrace();
}
if(localSession == null){
System.out.println("failed to get local session.");
}else{
System.out.println("got local session.");
}
//----------- register the id file
String idfile = "D:\\Program Files\\Lotus\\Notes\\data\\user.id";
Registration r;
try {
r = localSession.createRegistration();
r.switchToID(idfile, password);
} catch (NotesException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//------------- try to get database
lotus.domino.Database db = null;
try {
db = localSession.getDatabase("","localNSF");
} catch (NotesException e) {
e.printStackTrace();
}
if(db == null){
System.out.println("failed to get local db.");
}else{
System.out.println("got local db.");
}
try {
System.out.println("db title = " + db.getLastModified());
} catch (NotesException e) {
e.printStackTrace();
}
lotus.notes.NotesThread.stermThread();
[/code]-------------------------------------------------
before execute the code above, I include the location of notes.jar, ncso.jar and nlsxbe.dll in the PATH.
then when executing the code, I could getSession() 'successfully', I mean the 'localSession' is not null; then I could get database, it mean 'db' is not null; but when doing 'db.getLastModified()' call, I caught the following error:
[error] -----------------------------------------------
NotesException: Database localNSF.nsf has not been opened yet
at lotus.domino.local.NotesBase.PropGetDate(Native Method)
at lotus.domino.local.Database.getLastModified(Unknown Source)
at LocalSessionTry.main(LocalSessionTry.java:62)
[/error] -----------------------------------------------
Could anybody shed light on this? Is the session created successfully though it is not null? And why I could get a not-null db, but I could not get any content in it?
 
Feedback number WEBB7KDAW7 created by ~Hank Chuveluynds on 10/13/2008

Status: Open
Comments:

failed to access local database thr... (~Hank Chuveluyn... 13.Oct.08)
. . Example (~Tip Minreplopy... 13.Oct.08)
. . . . this is not a solution that we expe... (~Hank Chuveluyn... 13.Oct.08)
. . . . . . doesn't matter (~Tip Minreplopy... 13.Oct.08)
. . . . . . . . called db.open method, but still er... (~Hank Chuveluyn... 14.Oct.08)
. . . . . . . . . . it picks the lotus/Domino/data as t... (~Hank Chuveluyn... 14.Oct.08)
. . the error "database has not been op... (~Bill Frokimari... 13.Oct.08)
. . . . default nsf path is not ../Notes/da... (~Hank Chuveluyn... 15.Oct.08) |
|  |
|